﻿/*--------------------------------------------------------------
 * Author : Shine K Velayudhan 
 ---------------------------------------------------------------*/
using System;

namespace IQN.Logging
{
    public static class PerformanceLogExtensions
    {
        private static void log(this ILogger logger, MessageLevel messageLevel, string eventTag, string component, DateTime startTime, DateTime endTime, string tag1, string tag2)
        {
            if (null != logger)
            {
                logger.Log(messageLevel, eventTag, component, startTime, endTime, tag1, tag2);
            }
        }

        public static void RegisterDuration(this ILogger logger, string eventTag, string component, DateTime startTime, DateTime endTime)
        {
            logger.log(MessageLevel.Info, eventTag, component, startTime, endTime, string.Empty, string.Empty);
        }

        public static void RegisterDuration(this ILogger logger, string eventTag, string component, DateTime startTime, DateTime endTime, string tag1)
        {
            logger.log(MessageLevel.Info, eventTag, component, startTime, endTime, tag1, string.Empty);
        }

        public static void RegisterDuration(this ILogger logger, string eventTag, string component, DateTime startTime, DateTime endTime, string tag1, string tag2)
        {
            logger.log(MessageLevel.Info, eventTag, component, startTime, endTime, tag1, tag2);
        }

        public static void RegisterDuration(this ILogger logger, MessageLevel severity, string eventTag, string component, DateTime startTime, DateTime endTime, string tag1, string tag2)
        {
            logger.log(severity, eventTag, component, startTime, endTime, tag1, tag2);
        }
    }
}
